#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from inary.actionsapi import inarytools
from inary.actionsapi import shelltools
from inary.actionsapi import mesontools as tools
from inary.actionsapi import get

def setup():
    lib=""
    if get.buildTYPE() == "emul32":
        shelltools.export("CC","gcc -m32")
        shelltools.export("CXX","g++ -m32")
        shelltools.reset_env()
        shelltools.export("PKG_CONFIG_PATH","/lib32/pkgconfig:/usr/lib32/pkgconfig:/usr/share/pkgconfig")
        lib = "32"
    shelltools.system("""meson inaryPackageBuild \
                          --prefix=/usr/ \
                          --libdir=/usr/lib{0}/\
                       """.format(lib))

def build():
    tools.make()

def install():
    shelltools.system("DESTDIR='{}' ninja -C inaryPackageBuild install ".format(get.installDIR()))

